﻿using System;
using personalplaner.business.stamm;
using personalplaner.common.mvvm;

namespace personalplaner.gui.stamm.viewmodels.models
{
    public class PersonAdditionalInfoModel : BaseModel
    {
        int _pensum = 100;
        public int Pensum
        {
            get { return _pensum; }
            set
            {
                if (value > 100)
                    value = 100;
                if (value < 0)
                    value = 0;
                _pensum = value;
                RaisePropertyChanged("Pensum");
            }
        }

        DateTime _von;
        public DateTime Von
        {
            get { return _von; }
            set
            {
                // set first day in month
                _von = new DateTime(value.Year, value.Month, 1);
                RaisePropertyChanged("Von");

                if (_von > Bis)
                    Bis = _von;
            }
        }

        DateTime _bis;
        public DateTime Bis
        {
            get { return _bis; }
            set
            {
                // set last day in month
                _bis = new DateTime(value.Year, value.Month, DateTime.DaysInMonth(value.Year, value.Month));
                RaisePropertyChanged("Bis");

                if (_bis < Von)
                    Von = _bis;
            }
        }

        Anstellung _anstellung;
        public Anstellung Anstellung
        {
            get
            {
                return _anstellung;
            }
            set
            {
                _anstellung = value;
                RaisePropertyChanged("Anstellung");
            }
        }
    }
}
